import request from "@/common/request"

//规则表左树数据展示
export const leftTreeList = (queryForm) => {
    return request("get", "/rule/group/ruleGroup/list", queryForm);
}

//规则分组保存
export const ruleGroupSave = (data) => {
    return request("post", "/rule/group/ruleGroup/save", data);
}

//规则分组删除
export const ruleGroupDelete = (id) => {
    return request("post", `/rule/group/ruleGroup/delete?id=${id}`);
}

//规则分组编辑
export const ruleGroupEdit = (data) => {
    return request("post", "/rule/group/ruleGroup/edit", data);
}

//规则表分页展示
export const rulePage = (queryForm) => {
    return request("get", "/rule/page", queryForm);
}
//规则表列表展示
export const ruleList = (queryForm) => {
    return request("get", "/rule/list", queryForm);
}
//规则表详情
export const ruleInfo = (id) => {
    return request('get', '/rule/info', {
        id: id
    })
}
//规则表信息保存
export const ruleSave = (data) => {
    return request('post', '/rule/save', data)
}
//规则表信息修改
export const ruleEdit = (data) => {
    return request('post', '/rule/edit', data)
}
//规则表信息删除
export const ruleDel = (id) => {
    return request('post', '/rule/delete?id=' + id)
}
//规则表批量删除
export const ruleDelBatch = (ids) => {
    return request('post', '/rule/deleteBatch', ids)
}
//规则表动态表头导出
export const ruleDynamicExport = (data) => {
    return request("eptpost", '/rule/exportDynamic', data)
}

//批量修改规则分组
export const updateRuleGroup = (ids, scenarioId) => {
    return request("post", `/rule/updateGroup?scenarioId=${scenarioId}`, ids);
}

//规则清单信息表列表展示
export const rulelistList = (queryForm) => {
    return request("get", "/rule/list/ruleList/list", queryForm);
}

/**
 * 根据规则分组标题获取规则列表
 * @param {string} title 规则分组标题
 * @returns {Promise} 返回规则列表的Promise
 */
export const getRulesByTitle = (title) => {
    return request("get", "/rule/group/ruleGroup/getRulesByTitle", { title });
}

//规则清单与规则关联表批量保存
export const saveRuleListRuleBatch = (data) => {
    return request('post', '/rule/listRule/ruleListRule/saveBatch', data)
}
//规则清单与规则关联表保存
export const saveRuleListRule = (data) => {
    return request('post', '/rule/listRule/ruleListRule/save', data)
}

export const listRuleListRuleWithInfo = (queryForm) => {
    return request("get", "/rule/listRule/ruleListRule/withInfo", queryForm);
}


export const deleteRuleListRule = (id) => {
    return request('post', '/rule/listRule/ruleListRule/delete?id=' + id)
}
